import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;

import com.su.interfaces.IPlaugin;


public class Main {

	public static void main(String[] args) {
		String property = System.getProperty("user.dir");
		System.out.println(property);
		String loaderPath = property+File.separator+"loader"+File.separator+"plauginiml.jar";
		System.out.println(loaderPath);
		try {
		
			URL url = new File(loaderPath).toURL();
			System.out.println(url.toString());
			ClassLoader classLoader = Main.class.getClassLoader();
			
			URLClassLoader newInstance = URLClassLoader.newInstance(new URL[]{url});
			
			Class<?> loadClass = newInstance.loadClass("com.suj.iml.IPlauginIml");
			Object plaugin = loadClass.newInstance();
			if (plaugin instanceof IPlaugin) {
				System.out.println("load success");
			}
			IPlaugin iPlaugin = (IPlaugin)plaugin;
			iPlaugin.plaugin();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		

	}

}
